﻿<R:RibbonWindow x:Class="ActiveStory.UI.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ColorPicker="clr-namespace:Microsoft.Samples.CustomControls;assembly=ColorPicker"
        xmlns:Commands="clr-namespace:ActiveStory.UI.Commands"
        xmlns:R="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    Title="ActiveStory Enhanced" Height="768" Width="1024" 
        WindowStartupLocation="CenterScreen"  Loaded="Window_Loaded" Closing="Window_Closing" Name="MainWindowInstance" WindowStyle="SingleBorderWindow" MinWidth="966" MinHeight="732" Background="White" Icon="/ActiveStoryEnhanced;component/Content/icon.png" IconVisibility="Collapsed" WindowState="Normal">
    <Window.CommandBindings>
        <CommandBinding x:Name="NewProjectCommandBinding" Command="Commands:UICommands.NewProject" Executed="NewProjectCommandBinding_Executed" CanExecute="NewProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="OpenProjectCommandBinding" Command="Commands:UICommands.OpenProject" Executed="OpenProjectCommandBinding_Executed" CanExecute="OpenProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SaveProjectCommandBinding" Command="Commands:UICommands.SaveProject" Executed="SaveProjectCommandBinding_Executed" CanExecute="SaveProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ExportProjectCommandBinding" Command="Commands:UICommands.ExportProject" Executed="ExportProjectCommandBinding_Executed" CanExecute="ExportProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ExitActiveStoryCommandBinding" Command="Commands:UICommands.ExitActiveStory" Executed="ExitActiveStoryCommandBinding_Executed" CanExecute="ExitActiveStoryCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="DrawModeCommandBinding" Command="Commands:UICommands.DrawMode" Executed="DrawModeCommandBinding_Executed" CanExecute="DrawModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="PointEraserModeCommandBinding" Command="Commands:UICommands.PointEraserMode" Executed="PointEraserModeCommandBinding_Executed" CanExecute="PointEraserModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="StrokeEraserModeCommandBinding" Command="Commands:UICommands.StrokeEraserMode" Executed="StrokeEraserModeCommandBinding_Executed" CanExecute="StrokeEraserModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SelectionModeCommandBinding" Command="Commands:UICommands.SelectionMode" Executed="SelectionModeCommandBinding_Executed" CanExecute="SelectionModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="CreateLinkCommandBinding" Command="Commands:UICommands.CreateLink" Executed="CreateLinkCommandBinding_Executed" CanExecute="CreateLinkCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="RemoveLinkCommandBinding" Command="Commands:UICommands.RemoveLink" Executed="RemoveLinkCommandBinding_Executed" CanExecute="RemoveLinkCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ImportImageCommandBinding" Command="Commands:UICommands.ImportImage" Executed="ImportImageCommandBinding_Executed" CanExecute="ImportImageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="AddPageCommandBinding" Command="Commands:UICommands.AddPage" Executed="AddPageCommandBinding_Executed" CanExecute="AddPageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="DeletePageCommandBinding" Command="Commands:UICommands.DeletePage" Executed="DeletePageCommandBinding_Executed" CanExecute="DeletePageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="CarbonCopyPageCommandBinding" Command="Commands:UICommands.CarbonCopyPage" Executed="CarbonCopyPageCommandBinding_Executed" CanExecute="CarbonCopyPageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="RenamePageCommandBinding" Command="Commands:UICommands.RenamePage" Executed="RenamePageCommandBinding_Executed" CanExecute="RenamePageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SetPenColorCommandBinding" Command="Commands:UICommands.SetPenColor" Executed="SetPenColorCommandBinding_Executed" CanExecute="SetPenColorCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SetCanvasSizeCommandBinding" Command="Commands:UICommands.SetCanvasSize" CanExecute="SetCanvasSizeCommandBinding_CanExecute" Executed="SetCanvasSizeCommandBinding_Executed"></CommandBinding>
        <CommandBinding x:Name="AboutCommandBinding" Command="Commands:UICommands.About" Executed="AboutCommandBinding_Executed"></CommandBinding>
        <CommandBinding x:Name="UndoCommandBinding" Command="ApplicationCommands.Undo" Executed="UndoCommandBinding_Executed" CanExecute="UndoCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="RedoCommandBinding" Command="ApplicationCommands.Redo" Executed="RedoCommandBinding_Executed" CanExecute="RedoCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="BlueRibbonStyleCommandBinding" Command="Commands:UICommands.BlueRibbon" Executed="BlueRibbonStyleCommandBinding_Executed" CanExecute="BlueRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="BlackRibbonStyleCommandBinding" Command="Commands:UICommands.BlackRibbon" Executed="BlackRibbonStyleCommandBinding_Executed" CanExecute="BlackRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SilverRibbonStyleCommandBinding" Command="Commands:UICommands.SilverRibbon" Executed="SilverRibbonStyleCommandBinding_Executed" CanExecute="SilverRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="Win7RibbonStyleCommandBinding" Command="Commands:UICommands.Win7Ribbon" Executed="Win7RibbonStyleCommandBinding_Executed" CanExecute="Win7RibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="NoRibbonStyleCommandBinding" Command="Commands:UICommands.NoRibbon" Executed="NoRibbonStyleCommandBinding_Executed" CanExecute="NoRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="LeftyModeCommandBinding" Command="Commands:UICommands.LeftyMode" Executed="LeftyModeCommandBinding_Executed" CanExecute="LeftyModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ChangeDefaultCanvasColorCommandBinding" Command="Commands:UICommands.ChangeDefaultCanvasColor" CanExecute="ChangeDefaultCanvasColorCommandBinding_CanExecute" Executed="ChangeDefaultCanvasColorCommandBinding_Executed"></CommandBinding>
        <CommandBinding x:Name="ChangeCurrentCanvasColorCommandBinding" Command="Commands:UICommands.ChangeCurrentCanvasColor" Executed="ChangeCurrentCanvasColorCommandBinding_Executed" CanExecute="ChangeCurrentCanvasColorCommandBinding_CanExecute"></CommandBinding>
        <!--Ribbon Commands-->
        <CommandBinding x:Name="NewProjectRibbonCommandBinding" Command="Commands:RibbonUICommands.NewProject" Executed="NewProjectCommandBinding_Executed" CanExecute="NewProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="OpenProjectRibbonCommandBinding" Command="Commands:RibbonUICommands.OpenProject" Executed="OpenProjectCommandBinding_Executed" CanExecute="OpenProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SaveProjectRibbonCommandBinding" Command="Commands:RibbonUICommands.SaveProject" Executed="SaveProjectCommandBinding_Executed" CanExecute="SaveProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ExportProjectRibbonCommandBinding" Command="Commands:RibbonUICommands.ExportProject" Executed="ExportProjectCommandBinding_Executed" CanExecute="ExportProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ExportPageRibbonCommandBinding" Command="Commands:RibbonUICommands.ExportPageToImage" Executed="ExportProjectCommandBinding_Executed" CanExecute="ExportProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ExportAllPagesRibbonCommandBinding" Command="Commands:RibbonUICommands.ExportAllToImage" Executed="ExportProjectCommandBinding_Executed" CanExecute="ExportProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ExportWoZRibbonCommandBinding" Command="Commands:RibbonUICommands.ExportToWizardOfOz" Executed="ExportProjectCommandBinding_Executed" CanExecute="ExportProjectCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ExitActiveStoryRibbonCommandBinding" Command="Commands:RibbonUICommands.ExitActiveStory" Executed="ExitActiveStoryCommandBinding_Executed" CanExecute="ExitActiveStoryCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="DrawModeRibbonCommandBinding" Command="Commands:RibbonUICommands.DrawMode" Executed="DrawModeCommandBinding_Executed" CanExecute="DrawModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="PointEraserModeRibbonCommandBinding" Command="Commands:RibbonUICommands.PointEraserMode" Executed="PointEraserModeCommandBinding_Executed" CanExecute="PointEraserModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="StrokeEraserModeRibbonCommandBinding" Command="Commands:RibbonUICommands.StrokeEraserMode" Executed="StrokeEraserModeCommandBinding_Executed" CanExecute="StrokeEraserModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SelectionModeRibbonCommandBinding" Command="Commands:RibbonUICommands.SelectionMode" Executed="SelectionModeCommandBinding_Executed" CanExecute="SelectionModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="CreateLinkRibbonCommandBinding" Command="Commands:RibbonUICommands.CreateLink" Executed="CreateLinkCommandBinding_Executed" CanExecute="CreateLinkCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="RemoveLinkRibbonCommandBinding" Command="Commands:RibbonUICommands.RemoveLink" Executed="RemoveLinkCommandBinding_Executed" CanExecute="RemoveLinkCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ImportImageRibbonCommandBinding" Command="Commands:RibbonUICommands.ImportImage" Executed="ImportImageCommandBinding_Executed" CanExecute="ImportImageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="AddPageRibbonCommandBinding" Command="Commands:RibbonUICommands.AddPage" Executed="AddPageCommandBinding_Executed" CanExecute="AddPageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="DeletePageRibbonCommandBinding" Command="Commands:RibbonUICommands.DeletePage" Executed="DeletePageCommandBinding_Executed" CanExecute="DeletePageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="CarbonCopyPageRibbonCommandBinding" Command="Commands:RibbonUICommands.CarbonCopyPage" Executed="CarbonCopyPageCommandBinding_Executed" CanExecute="CarbonCopyPageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="RenamePageRibbonCommandBinding" Command="Commands:RibbonUICommands.RenamePage" Executed="RenamePageCommandBinding_Executed" CanExecute="RenamePageCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SetPenColorRibbonCommandBinding" Command="Commands:RibbonUICommands.SetPenColor" Executed="SetPenColorCommandBinding_Executed" CanExecute="SetPenColorCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SetCanvasSizeRibbonCommandBinding" Command="Commands:RibbonUICommands.SetCanvasSize" CanExecute="SetCanvasSizeCommandBinding_CanExecute" Executed="SetCanvasSizeCommandBinding_Executed"></CommandBinding>
        <CommandBinding x:Name="AboutRibbonCommandBinding" Command="Commands:RibbonUICommands.About" Executed="AboutCommandBinding_Executed"></CommandBinding>
        <CommandBinding x:Name="UndoRibbonCommandBinding" Command="Commands:RibbonUICommands.Undo" Executed="UndoCommandBinding_Executed" CanExecute="UndoCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="RedoRibbonCommandBinding" Command="Commands:RibbonUICommands.Redo" Executed="RedoCommandBinding_Executed" CanExecute="RedoCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="BlueStyleRibbonCommandBinding" Command="Commands:RibbonUICommands.BlueRibbon" Executed="BlueRibbonStyleCommandBinding_Executed" CanExecute="BlueRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="BlackStyleRibbonCommandBinding" Command="Commands:RibbonUICommands.BlackRibbon" Executed="BlackRibbonStyleCommandBinding_Executed" CanExecute="BlackRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="SilverStyleRibbonCommandBinding" Command="Commands:RibbonUICommands.SilverRibbon" Executed="SilverRibbonStyleCommandBinding_Executed" CanExecute="SilverRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="Win7StyleRibbonCommandBinding" Command="Commands:RibbonUICommands.Win7Ribbon" Executed="Win7RibbonStyleCommandBinding_Executed" CanExecute="Win7RibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="StandardStyleRibbonCommandBinding" Command="Commands:RibbonUICommands.NoRibbon" Executed="NoRibbonStyleCommandBinding_Executed" CanExecute="NoRibbonStyleCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="LeftyModeRibbonCommandBinding" Command="Commands:RibbonUICommands.LeftyMode" Executed="LeftyModeCommandBinding_Executed" CanExecute="LeftyModeCommandBinding_CanExecute"></CommandBinding>
        <CommandBinding x:Name="ChangeDefaultCanvasColorRibbonCommandBinding" Command="Commands:RibbonUICommands.ChangeDefaultCanvasColor" CanExecute="ChangeDefaultCanvasColorCommandBinding_CanExecute" Executed="ChangeDefaultCanvasColorCommandBinding_Executed"></CommandBinding>
        <CommandBinding x:Name="ChangeCurrentCanvasColorRibbonCommandBinding" Command="Commands:RibbonUICommands.ChangeCurrentCanvasColor" Executed="ChangeCurrentCanvasColorCommandBinding_Executed" CanExecute="ChangeCurrentCanvasColorCommandBinding_CanExecute"></CommandBinding>
    </Window.CommandBindings>

    <Grid>
        <DockPanel LastChildFill="True" Name="BaseDockPanel">
            <R:Ribbon DockPanel.Dock="Top" Title="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=Title}" Name="MainRibbonMenu">

                <R:Ribbon.Resources>
                    <R:RibbonGroupSizeDefinitionCollection x:Key="RibbonLayout">
                        <R:RibbonGroupSizeDefinition>
                            <!-- Control sizes: L,L,L -->
                            <R:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <R:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <R:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                        </R:RibbonGroupSizeDefinition>
                        <R:RibbonGroupSizeDefinition>
                            <!-- Control sizes: L,M,M -->
                            <R:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <R:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True"/>
                            <R:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="True"/>
                        </R:RibbonGroupSizeDefinition>
                        <R:RibbonGroupSizeDefinition>
                            <!-- Control sizes: L,S,S -->
                            <R:RibbonControlSizeDefinition ImageSize="Large" IsLabelVisible="True"/>
                            <R:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="False"/>
                            <R:RibbonControlSizeDefinition ImageSize="Small" IsLabelVisible="False"/>
                        </R:RibbonGroupSizeDefinition>
                        <!-- Collapsed -->
                        <R:RibbonGroupSizeDefinition IsCollapsed="True" />
                    </R:RibbonGroupSizeDefinitionCollection>
                </R:Ribbon.Resources>

                <!-- Define the application icon in the org -->
                <R:Ribbon.ApplicationMenu>
                    <R:RibbonApplicationMenu>
                        <R:RibbonApplicationMenu.Command>
                            <R:RibbonCommand 
                                LabelTitle="Application Button"
                                ToolTipTitle="ActiveStory Enhanced"
                                ToolTipDescription="Click here to open or save a project." 
                                LargeImageSource="/ActiveStoryEnhanced;component/Content/icon.png" 
                                SmallImageSource="/ActiveStoryEnhanced;component/Content/icon.png" />
                        </R:RibbonApplicationMenu.Command>
                        <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.NewProject" />
                        <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.SaveProject" />
                        <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.OpenProject" />
                        <R:RibbonApplicationSplitMenuItem Command="Commands:RibbonUICommands.ExportProject" CommandParameter="0">
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.ExportToWizardOfOz" CommandParameter="0"></R:RibbonApplicationMenuItem>
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.ExportPageToImage" CommandParameter="1"></R:RibbonApplicationMenuItem>
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.ExportAllToImage" CommandParameter="2"></R:RibbonApplicationMenuItem>
                        </R:RibbonApplicationSplitMenuItem>
                        <R:RibbonApplicationSplitMenuItem>
                            <R:RibbonApplicationSplitMenuItem.Command>
                                <R:RibbonCommand x:Name="InterfaceMenu" LabelTitle="Interface Style" ToolTipTitle="Interface Style" 
                                                 ToolTipDescription="Select the style for the interface."
                                                 CanExecute="InterfaceMenu_CanExecute" Executed="BlackRibbonStyleCommandBinding_Executed"
                                                 />
                            </R:RibbonApplicationSplitMenuItem.Command>
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.BlackRibbon"></R:RibbonApplicationMenuItem>
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.BlueRibbon"></R:RibbonApplicationMenuItem>
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.SilverRibbon"></R:RibbonApplicationMenuItem>
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.Win7Ribbon"></R:RibbonApplicationMenuItem>
                            <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.NoRibbon"></R:RibbonApplicationMenuItem>
                        </R:RibbonApplicationSplitMenuItem>
                        <R:RibbonApplicationMenuItem Command="Commands:RibbonUICommands.ExitActiveStory" />
                    </R:RibbonApplicationMenu>
                </R:Ribbon.ApplicationMenu>

                <!-- Quick pick menu -->
                <R:Ribbon.QuickAccessToolBar>
                    <R:RibbonQuickAccessToolBar CanUserCustomize="True">
                        <R:RibbonButton Command="Commands:RibbonUICommands.NewProject" R:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                        <R:RibbonButton Command="Commands:RibbonUICommands.SaveProject" R:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                        <R:RibbonButton Command="Commands:RibbonUICommands.OpenProject" R:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                        <R:RibbonSeparator></R:RibbonSeparator>
                        <R:RibbonButton Command="Commands:RibbonUICommands.Undo" R:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                        <R:RibbonButton Command="Commands:RibbonUICommands.Redo" R:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                    </R:RibbonQuickAccessToolBar>
                </R:Ribbon.QuickAccessToolBar>

                <!--Tabs -->
                <R:RibbonTab Label="Tools" Name="ToolsRibbonTab">
                    <R:RibbonTab.Groups>
                        <R:RibbonGroup Name="DrawModeRibbonGroup" GroupSizeDefinitions="{StaticResource RibbonLayout}">
                            <R:RibbonGroup.Command>
                                <R:RibbonCommand LabelTitle="Pen Mode"/>
                            </R:RibbonGroup.Command>
                            <R:RibbonButton Command="Commands:RibbonUICommands.DrawMode"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.PointEraserMode"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.StrokeEraserMode"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.SelectionMode"></R:RibbonButton>
                        </R:RibbonGroup>
                        <R:RibbonGroup Name="LinkingRibbonGroup" GroupSizeDefinitions="{StaticResource RibbonLayout}">
                            <R:RibbonGroup.Command>
                                <R:RibbonCommand LabelTitle="Linking" />
                            </R:RibbonGroup.Command>
                            <R:RibbonButton Command="Commands:RibbonUICommands.CreateLink"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.RemoveLink"></R:RibbonButton>
                        </R:RibbonGroup>
                        <R:RibbonGroup Name="ImportRibbonGroup" GroupSizeDefinitions="{StaticResource RibbonLayout}">
                            <R:RibbonGroup.Command>
                                <R:RibbonCommand LabelTitle="Import"/>
                            </R:RibbonGroup.Command>
                            <R:RibbonButton Command="Commands:RibbonUICommands.ImportImage"></R:RibbonButton>


                        </R:RibbonGroup>
                        <R:RibbonGroup Name="ExportRibbonGroup" GroupSizeDefinitions="{StaticResource RibbonLayout}" Command="Commands:RibbonUICommands.ExportProject" CommandParameter="0" HasDialogLauncher="True">
                            <R:RibbonButton Command="Commands:RibbonUICommands.ExportToWizardOfOz" CommandParameter="0"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.ExportPageToImage" CommandParameter="1"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.ExportAllToImage" CommandParameter="2"></R:RibbonButton>
                        </R:RibbonGroup>



                    </R:RibbonTab.Groups>
                </R:RibbonTab>
                <R:RibbonTab Label="Page" Name="PageRibbonTab">
                    <R:RibbonTab.Groups>
                        <R:RibbonGroup Name="PageRibbonGroup" GroupSizeDefinitions="{StaticResource RibbonLayout}">
                            <R:RibbonGroup.Command>
                                <R:RibbonCommand LabelTitle="Page"/>
                            </R:RibbonGroup.Command>
                            <R:RibbonButton Command="Commands:RibbonUICommands.AddPage"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.DeletePage"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.CarbonCopyPage"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.RenamePage"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.SetCanvasSize"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.ChangeDefaultCanvasColor"></R:RibbonButton>
                            <R:RibbonButton Command="Commands:RibbonUICommands.ChangeCurrentCanvasColor"></R:RibbonButton>
                        </R:RibbonGroup>
                    </R:RibbonTab.Groups>
                </R:RibbonTab>
                <R:RibbonTab Label="Settings" Name="SettingsRibbonTab">
                    <R:RibbonTab.Groups>
                        <R:RibbonGroup Name="SettingsRibbonGroup" GroupSizeDefinitions="{StaticResource RibbonLayout}">
                            <R:RibbonGroup.Command>
                                <R:RibbonCommand LabelTitle="UI Layout"/>
                            </R:RibbonGroup.Command>
                            <R:RibbonToggleButton Name="LeftyModeRibbonToggleButton" Command="Commands:RibbonUICommands.LeftyMode"></R:RibbonToggleButton>
                        </R:RibbonGroup>
                    </R:RibbonTab.Groups>
                </R:RibbonTab>
                <!--<R:RibbonTab Label="Extras" Name="ExtrasRibbonTab">
                </R:RibbonTab>-->
            </R:Ribbon>
            <Menu Name="StandardMenu" VerticalAlignment="Top" Height="25" DockPanel.Dock="Top" IsTextSearchEnabled="True" Margin="0,25,0,0" Visibility="Collapsed">
                <MenuItem Header="_File" IsTabStop="False">
                    <MenuItem Header="_New Project" Name="FileNewMenuItem" Command="Commands:UICommands.NewProject"></MenuItem>
                    <MenuItem Header="_Save Project" Name="FileSaveMenuItem" Command="Commands:UICommands.SaveProject"></MenuItem>
                    <MenuItem Header="_Open Project" Name="FileOpenMenuItem" Command="Commands:UICommands.OpenProject"></MenuItem>
                    <Separator></Separator>
                    <MenuItem Header="_Export" Name="FileExportMenuItem">
                        <MenuItem Header="Export Current Page to Image" Command="Commands:UICommands.ExportProject" CommandParameter="1"></MenuItem>
                        <MenuItem Header="Export All Pages to Images" Command="Commands:UICommands.ExportProject" CommandParameter="2"></MenuItem>
                        <MenuItem Header="Export to Wizard of Oz tool" Command="Commands:UICommands.ExportProject" CommandParameter="0"></MenuItem>
                    </MenuItem>
                    <Separator></Separator>
                    <MenuItem Header="Interface Style">
                        <MenuItem Header="Black Office 2007 Ribbon" Command="Commands:UICommands.BlackRibbon"></MenuItem>
                        <MenuItem Header="Blue Office 2007 Ribbon" Command="Commands:UICommands.BlueRibbon"></MenuItem>
                        <MenuItem Header="Silver Office 2007 Ribbon" Command="Commands:UICommands.SilverRibbon"></MenuItem>
                        <MenuItem Header="Windows 7 Ribbon" Command="Commands:UICommands.Win7Ribbon"></MenuItem>
                        <MenuItem Header="Standard" Command="Commands:UICommands.NoRibbon"></MenuItem>
                    </MenuItem>
                    <Separator></Separator>
                    <MenuItem Header="Left-Handed Mode" Name="LeftyModeMenuItem" IsCheckable="True" Command="Commands:UICommands.LeftyMode"/>
                    <Separator></Separator>
                    <MenuItem Header="E_xit" Name="FileExitMenuItem" Command="Commands:UICommands.ExitActiveStory" />
                </MenuItem>
                <MenuItem Header="_Edit" IsTabStop="False">
                    <MenuItem Header="_Mode">
                        <MenuItem Header="_Draw" Name="EditDrawMenuItem" Command="Commands:UICommands.DrawMode"></MenuItem>
                        <MenuItem Header="_Point Eraser" Name="EditPointEraserMenuItem" Command="Commands:UICommands.PointEraserMode"></MenuItem>
                        <MenuItem Header="Stro_ke Eraser" Name="EditStrokeEraserMenuItem" Command="Commands:UICommands.StrokeEraserMode"></MenuItem>
                        <MenuItem Header="_Selection" Name="EditSelectMenuItem" Command="Commands:UICommands.SelectionMode"></MenuItem>
                    </MenuItem>
                    <MenuItem Header="_Create Link" Name="EditCreateLinkMenuItem" Command="Commands:UICommands.CreateLink"></MenuItem>
                    <MenuItem Header="_Remove Link" Name="EditRemoveLinkMenuItem" Command="Commands:UICommands.RemoveLink"></MenuItem>
                    <MenuItem Header="_Import Image" Name="EditImportImageMenuItem" Command="Commands:UICommands.ImportImage"></MenuItem>
                    <MenuItem Header="_Pen Color" Name="EditPenColorMenuItem" Command="Commands:UICommands.SetPenColor"></MenuItem>
                    <MenuItem Header="Canvas _Size" Name="CanvasSizeMenuItem" Command="Commands:UICommands.SetCanvasSize"></MenuItem>
                    <MenuItem Header="Default Canvas Color" Name="DefaultCanvasColorMenuItem" Command="Commands:UICommands.ChangeDefaultCanvasColor"></MenuItem>
                    <MenuItem Header="Canvas Color" Name="CurrentCanvasColorMenuItem" Command="Commands:UICommands.ChangeCurrentCanvasColor"></MenuItem>
                </MenuItem>
                <MenuItem Header="_Page" IsTabStop="False">
                    <MenuItem Header="Add _New Page" Name="PageAddMenuItem" Command="Commands:UICommands.AddPage"></MenuItem>
                    <MenuItem Header="_Delete Page" Name="PageDeleteMenuItem" Command="Commands:UICommands.DeletePage"></MenuItem>
                </MenuItem>
                <MenuItem Header="_Help" IsTabStop="False">
                    <MenuItem Header="_About..." Name="HelpAboutMenuItem" Command="Commands:UICommands.About"></MenuItem>
                </MenuItem>
            </Menu>
            <ToolBarTray DockPanel.Dock="Top" Height="30" IsEnabled="True" Visibility="Collapsed">
                <ToolBar Band="0" BandIndex="0" MinWidth="30">
                    <Button Name="NewProjectToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Create a new project" ToolBar.OverflowMode="Never" Command="Commands:UICommands.NewProject" IsTabStop="False">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Content/NewProject.png" />
                        </StackPanel>
                    </Button>
                    <Button Name="SaveToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Save the project" ToolBar.OverflowMode="Never" Command="Commands:UICommands.SaveProject" IsTabStop="False">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Content/Save.png" />
                        </StackPanel>
                    </Button>
                    <Button Name="OpenProjectToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Open another Project" ToolBar.OverflowMode="Never" Command="Commands:UICommands.OpenProject" IsTabStop="False">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Content/OpenProject.png" />
                        </StackPanel>
                    </Button>
                    <Separator></Separator>
                    <Button Name="ExportToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Export to Wizard of Oz Tool" ToolBar.OverflowMode="Never" Command="Commands:UICommands.ExportProject" CommandParameter="0" IsEnabled="True" IsTabStop="False">
                        <Image Source="../Content/export_img.png" />
                    </Button>
                </ToolBar>
                <ToolBar Band="0" BandIndex="1" MinWidth="30">
                    <Button Name="DrawToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Draw Mode" ToolBar.OverflowMode="Never" Command="Commands:UICommands.DrawMode" IsTabStop="False">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../Content/pen_img.png" />
                        </StackPanel>
                    </Button>
                    <Button Name="EraseToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Point Eraser Mode" ToolBar.OverflowMode="Never" Command="Commands:UICommands.PointEraserMode" IsTabStop="False">
                        <Image Source="../Content/PointEraser.png" />
                    </Button>
                    <Button Name="EraseStrokeToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Stroke Eraser Mode" ToolBar.OverflowMode="Never" Command="Commands:UICommands.StrokeEraserMode" IsTabStop="False">
                        <Image Source="../Content/StrokeEraser.png" />
                    </Button>
                    <Button Name="SelectionModeToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Selection Mode" ToolBar.OverflowMode="Never" Command="Commands:UICommands.SelectionMode" IsTabStop="False">
                        <Image Source="../Content/Selection.png" />
                    </Button>
                    <Button Name="CreateLinkToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Create a Link" ToolBar.OverflowMode="Never" Command="Commands:UICommands.CreateLink" IsTabStop="False">
                        <Image Source="../Content/CreateLink.png" />
                    </Button>
                    <Button Name="RemoveLinkToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Remove a Link" ToolBar.OverflowMode="Never" Command="Commands:UICommands.RemoveLink" IsTabStop="False">
                        <Image Source="../Content/RemoveLink.png" />
                    </Button>
                    <Button Name="ImportImageToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Import an image" ToolBar.OverflowMode="Never" Command="Commands:UICommands.ImportImage" IsTabStop="False">
                        <Image Source="../Content/ImportImage.png" />
                    </Button>

                </ToolBar>
                <ToolBar Band="0" BandIndex="2" MinWidth="30">
                    <Button Name="AddPageToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Add Page" ToolBar.OverflowMode="Never" Command="Commands:UICommands.AddPage" IsTabStop="False">
                        <Image Source="../Content/AddPage.png" />
                    </Button>
                    <Button Name="DeletePageToolbarButton" Style="{StaticResource ToolBarButton}" ToolTip="Remove Page" ToolBar.OverflowMode="Never" Command="Commands:UICommands.DeletePage" IsTabStop="False">
                        <Image Source="../Content/DeletePage.png" />
                    </Button>
                </ToolBar>
            </ToolBarTray>
            <StatusBar Name="BottomStatusBar" Height="35" VerticalAlignment="Bottom" DockPanel.Dock="Bottom">
                <Grid Width="{Binding ElementName=BottomStatusBar,Path=ActualWidth}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="45" />
                        <ColumnDefinition Width="100" />
                        <ColumnDefinition Width="90" />
                        <ColumnDefinition Width="45" />
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition Width="75" />
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition Width="75" />
                        <ColumnDefinition Width="130" />
                        <ColumnDefinition Width="30" />
                        <ColumnDefinition/>
                        <ColumnDefinition Width="50" />
                        <ColumnDefinition Width="45" />
                        <ColumnDefinition Width="148"/>
                        <ColumnDefinition Width="15"/>
                    </Grid.ColumnDefinitions>
                    <Button Name="TestButton" Panel.ZIndex="1" Click="TestButton_Click">Test</Button>
                    <Border Grid.Column="0" BorderBrush="SlateGray" BorderThickness="1,1,2,1" CornerRadius="0,0,0,10">
                        <Label Name="ModeLabel" >Mode:</Label>
                    </Border>
                    <Border Grid.Column="1" BorderBrush="SlateGray" BorderThickness="0,1,3,1" CornerRadius="0,0,10,0">
                        <Label Name="ModeValueLabel">Draw</Label>
                    </Border>
                    <Border Grid.Column="2" BorderBrush="SlateGray" BorderThickness="3,1,2,1" CornerRadius="0,0,0,10">
                        <Label Name="PageNumberLabel">Page Number:</Label>
                    </Border>
                    <Border Grid.Column="3" BorderBrush="SlateGray" BorderThickness="0,1,3,1" CornerRadius="0,0,10,0">
                        <Label Name="PageNumberValueLabel"></Label>
                    </Border>
                    <Border Grid.Column="4" BorderBrush="SlateGray" BorderThickness="3,1,2,1" CornerRadius="0,0,0,10">
                        <Label Name="CanvasWidthStatusBarLabel">Width:</Label>
                    </Border>
                    <Border Grid.Column="5" BorderBrush="SlateGray" BorderThickness="0,1,3,1" CornerRadius="0,0,10,0">
                        <Label Name="CanvasWidthValueStatusLabel" Content="{Binding ElementName=InkCanvasBorder,Path=Width}"></Label>
                    </Border>
                    <Border Grid.Column="6" BorderBrush="SlateGray" BorderThickness="3,1,2,1" CornerRadius="0,0,0,10">
                        <Label Name="CanvasHeightStatusBarLabel">Height:</Label>
                    </Border>
                    <Border Grid.Column="7" BorderBrush="SlateGray" BorderThickness="0,1,3,1" CornerRadius="0,0,10,0">
                        <Label Name="CanvasHeightValueStatusLabel" Content="{Binding ElementName=InkCanvasBorder,Path=Height}"></Label>
                    </Border>
                    <Border Grid.Column="8" BorderBrush="SlateGray" BorderThickness="3,1,2,1" CornerRadius="0,0,0,10">
                        <Label Name="DefCanvasColorStatusBarLabel">Default Canvas Color:</Label>
                    </Border>
                    <Border Grid.Column="9" BorderBrush="SlateGray" BorderThickness="0,1,3,1" CornerRadius="0,0,10,0">
                        <Button Style="{StaticResource ColorButton}" Name="DefCanvasColorValueStatusButton" Background="{Binding ElementName=MainWindowInstance,Path=DefaultCanvasColor}" Command="Commands:UICommands.ChangeDefaultCanvasColor"></Button>
                    </Border>
                    <Border Grid.Column="11" BorderBrush="SlateGray" BorderThickness="3,1,2,1" CornerRadius="0,0,0,10">
                        <Label Name="ZoomStatusBarLabel">Zoom:</Label>
                    </Border>
                    <Border Grid.Column="12" BorderBrush="SlateGray" BorderThickness="0,1,3,1" CornerRadius="0,0,10,0">
                        <Label Name="ZoomValueStatusLabel" Content="{Binding ElementName=ZoomSlider,Path=Value}"></Label>
                    </Border>
                    <Border Grid.Row="0" Grid.Column="13" BorderBrush="SlateGray" BorderThickness="3,1,3,1" CornerRadius="0,0,10,10">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="20"/>
                                <ColumnDefinition />
                                <ColumnDefinition Width="20"/>
                            </Grid.ColumnDefinitions>
                            <Image Grid.Column="0" Height="20" HorizontalAlignment="Center" Source="../Content/Zoom_Out.png"/>
                            <Slider Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center" Name="ZoomSlider" Value="1" Minimum="0.1" Maximum="5" IsSnapToTickEnabled="True" TickFrequency="0.1" TabIndex="16" TickPlacement="Both"></Slider>
                            <Image Grid.Column="2" Height="20" HorizontalAlignment="Center" Source="../Content/Zoom_In.png"/>
                        </Grid>
                    </Border>
                </Grid>
            </StatusBar>
            <DockPanel Name="ControlAreaDockPanel" LastChildFill="True">
                <Expander Name="ToolsExpander" DockPanel.Dock="Top" Header="Tools" ExpandDirection="Down" IsExpanded="True" BorderBrush="Black" Visibility="Collapsed">
                    <UniformGrid Name="LeftPanel" Rows="1" Columns="8" Height="85">
                        <Button Style="{StaticResource ImageButton}" Name="DrawButton" Grid.Column="0" ToolTip="Draw freestyle with a mouse or stylus." Command="Commands:UICommands.DrawMode" TabIndex="0">
                            <StackPanel>
                                <Image Source="../Content/pen_img.png" Height="45" Width="51"></Image>
                                <Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center">Draw</Label>
                            </StackPanel>
                        </Button>
                        <Button Name="EraseButton" Style="{StaticResource ImageButton}" Grid.Column="1" Command="Commands:UICommands.PointEraserMode" TabIndex="1">
                            <StackPanel>
                                <Image Source="../Content/PointEraser.png" Height="45" Width="51"></Image>
                                <Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center">Point Eraser</Label>
                            </StackPanel>
                        </Button>
                        <Button Name="EraseByStrokeButton" Style="{StaticResource ImageButton}" Grid.Column="2" Command="Commands:UICommands.StrokeEraserMode" TabIndex="2">
                            <StackPanel>
                                <Image Source="../Content/StrokeEraser.png" Height="45" Width="51"></Image>
                                <Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center">Stroke Eraser</Label>
                            </StackPanel>
                        </Button>
                        <Button Name="SelectionModeButton" Style="{StaticResource ImageButton}" Grid.Column="3" Command="Commands:UICommands.SelectionMode" TabIndex="3">
                            <StackPanel>
                                <Image Source="../Content/Selection.png" Height="45" Width="51"></Image>
                                <Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center">Select</Label>
                            </StackPanel>
                        </Button>
                        <Button Name="CreateLinkButton" Grid.Column="4" Style="{StaticResource ImageButton}" Command="Commands:UICommands.CreateLink" TabIndex="4">
                            <StackPanel>
                                <Image Source="../Content/CreateLink.png" Height="45" Width="51"></Image>
                                <Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center">Create Link</Label>
                            </StackPanel>
                        </Button>
                        <Button Name="RemoveLinkButton" Style="{StaticResource ImageButton}" Grid.Column="5" Command="Commands:UICommands.RemoveLink" TabIndex="5">
                            <StackPanel>
                                <Image Source="../Content/RemoveLink.png" Height="45" Width="51"></Image>
                                <Label HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center">Remove Link</Label>
                            </StackPanel>
                        </Button>
                        <Button Name="ImportImageButton" Style="{StaticResource ImageButton}" Grid.Column="6" Command="Commands:UICommands.ImportImage" TabIndex="6">
                            <StackPanel>
                                <Image Source="../Content/ImportImage.png" Height="45" Width="51"></Image>
                                <Label Width="87" HorizontalAlignment="Center" HorizontalContentAlignment="Center" VerticalAlignment="Center" VerticalContentAlignment="Center">Import Image</Label>
                            </StackPanel>
                        </Button>
                        <Button Grid.Column="7" Name="ExportButton" Style="{StaticResource ImageButton}" HorizontalAlignment="Center" Command="Commands:UICommands.ExportProject" CommandParameter="0" TabIndex="18">
                            <StackPanel>
                                <Image Source="../Content/export_img.png" Height="45" Width="51"></Image>
                                <Label HorizontalAlignment="Center" FlowDirection="LeftToRight" HorizontalContentAlignment="Center" VerticalAlignment="Center">Export</Label>
                            </StackPanel>
                        </Button>
                    </UniformGrid>
                </Expander>
                <Expander DockPanel.Dock="Bottom" ExpandDirection="Up" Header="Pages" IsExpanded="True" BorderBrush="Black" BorderThickness="1">
                    <Grid Name="PagesPanel">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="109" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0"/>
                            <ColumnDefinition Width="0"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Button Name="AddPageButton" Visibility="Collapsed" Style="{StaticResource ImageButton}" Grid.Column="0" Grid.Row="0" Command="Commands:UICommands.AddPage" TabIndex="7">
                            <StackPanel>
                                <Image Source="../Content/AddPage.png" Height="45" Width="51"></Image>
                                <Label HorizontalContentAlignment="Center">New Page</Label>
                            </StackPanel>
                        </Button>
                        <Button Name="DeletePageButton" Visibility="Collapsed" Style="{StaticResource ImageButton}" Grid.Column="1" Grid.Row="0" Command="Commands:UICommands.DeletePage" TabIndex="8">
                            <StackPanel>
                                <Image Source="../Content/DeletePage.png" Height="45" Width="51"></Image>
                                <Label HorizontalContentAlignment="Center">Delete Page</Label>
                            </StackPanel>
                        </Button>
                        <ListBox Grid.Column="3" Grid.Row="0" Style="{StaticResource HorizontalListBox}" ItemTemplate="{StaticResource HorizontalImageListTemplate}" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch" Name="PageListBox" VerticalAlignment="Stretch" BorderThickness="0" SelectionChanged="PageListBox_SelectionChanged" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                            <ListBox.ContextMenu>
                                <ContextMenu>
                                    <MenuItem Header="_Rename Page" Name="RenamePageContextMenuItem" Command="Commands:UICommands.RenamePage"></MenuItem>
                                    <MenuItem Header="_Carbon Copy Page" Name="PageCopyContextMenuItem" Command="Commands:UICommands.CarbonCopyPage"></MenuItem>
                                    <MenuItem Header="_Delete Page" Name="PageDeleteContextMenuItem" Command="Commands:UICommands.DeletePage"></MenuItem>
                                </ContextMenu>
                            </ListBox.ContextMenu>
                        </ListBox>

                    </Grid>
                </Expander>
                <Expander DockPanel.Dock="Top" ExpandDirection="Down" Header="Pen Palette" IsExpanded="True" BorderBrush="Black">
                    <Grid Name="BottomPanel" DockPanel.Dock="Bottom" Height="79">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="160" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="160" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="50" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition Width="160" />
                            <ColumnDefinition Width="5" />
                            <ColumnDefinition />
                            <ColumnDefinition Width="0" />
                            <!--5-->
                            <ColumnDefinition Width="0"/>
                            <!--150-->
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="0" BorderBrush="Black" BorderThickness="1" CornerRadius="5,5,5,5">
                            <StackPanel HorizontalAlignment="Left" Orientation="Vertical">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="30"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Grid.Column="0" Height="10" HorizontalAlignment="Center" Source="../Content/SmallBrushSize.png"/>
                                    <Label Grid.Column="1" HorizontalAlignment="Center">Pen Size</Label>
                                    <Image Grid.Column="2" Height="15" HorizontalAlignment="Center" Source="../Content/BigBrushSize.png"/>
                                </Grid>
                                <StackPanel Orientation="Horizontal">
                                    <Label Width="48">Width:</Label>
                                    <Slider Name="PenWidthSlider" HorizontalAlignment="Left" VerticalAlignment="Center" Width="105" Value="{Binding ElementName=CurrentInkCanvas, Path=DefaultDrawingAttributes.Width, Mode=TwoWay}" TabIndex="9"></Slider>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Label Width="48">Height:</Label>
                                    <Slider Name="PenHeightSlider" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="105" Value="{Binding ElementName=CurrentInkCanvas, Path=DefaultDrawingAttributes.Height, Mode=TwoWay}" TabIndex="10"></Slider>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                        <Border Grid.Column="2" BorderBrush="Black" BorderThickness="1" CornerRadius="5,5,5,5">
                            <StackPanel HorizontalAlignment="Center">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="30"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="30"/>
                                    </Grid.ColumnDefinitions>
                                    <Image Grid.Column="0" Height="12" HorizontalAlignment="Center" Source="../Content/EraserSizeImage.png"/>
                                    <Label Grid.Column="1" HorizontalAlignment="Center">Eraser Size</Label>
                                    <Image Grid.Column="2" Height="20" HorizontalAlignment="Center" Source="../Content/EraserSizeImage.png"/>
                                </Grid>
                                <StackPanel Orientation="Horizontal">
                                    <Label Width="48">Width:</Label>
                                    <Slider Name="EraserWidthSlider" HorizontalAlignment="Left" VerticalAlignment="Center" Width="105"  Maximum="25" TabIndex="11"></Slider>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal">
                                    <Label Width="48">Height:</Label>
                                    <Slider Name="EraserHeightSlider" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="105"  Maximum="25" TabIndex="12"></Slider>
                                </StackPanel>
                            </StackPanel>
                        </Border>
                        <Border Grid.Column="4" BorderBrush="Black" BorderThickness="1" CornerRadius="5">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition/>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>
                                <Label Grid.Row="0" HorizontalContentAlignment="Center">Shape</Label>
                                <ToggleButton Name="CirclePenShapeToggleButton" Grid.Row="2" Background="Transparent" BorderBrush="Transparent" IsChecked="True" Checked="CirclePenShapeToggleButton_Checked">
                                    <Ellipse Height="18" Width="18" Stroke="Black" Fill="Black"></Ellipse>
                                </ToggleButton>
                                <ToggleButton Name="RectPenShapeToggleButton" Grid.Row="4" Background="Transparent" BorderBrush="Transparent" Checked="RectPenShapeToggleButton_Checked">
                                    <Rectangle Height="18" Width="18" Stroke="Black" Fill="Black"></Rectangle>
                                </ToggleButton>
                            </Grid>
                        </Border>

                        <Border Grid.Column="6" BorderBrush="Black" BorderThickness="1" CornerRadius="5">
                            <StackPanel HorizontalAlignment="Left" Orientation="Vertical" Width="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Border}},Path=ActualWidth}">
                                <Label Content="Pen Tip" HorizontalContentAlignment="Center"></Label>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <Label Grid.Column="0">Rotate:</Label>
                                    
                                    <DockPanel Grid.Column="1" LastChildFill="True">
                                        <Label DockPanel.Dock="Left">0</Label>
                                        <Label DockPanel.Dock="Right">π</Label>
                                        <Slider Name="PenRotationSlider" Grid.Column="1" Minimum="0" Maximum="180" ValueChanged="PenRotationSlider_ValueChanged"></Slider>
                                    </DockPanel>
                                
                                    <Label Grid.Column="0" Grid.Row="1">Skew:</Label>
                                    <DockPanel Grid.Column="1" Grid.Row="1" LastChildFill="True">
                                        <Label DockPanel.Dock="Left">L</Label>
                                        <Label DockPanel.Dock="Right">R</Label>
                                        <Slider Name="PenSkewSlider" Grid.Column="1" ValueChanged="PenSkewSlider_ValueChanged" Minimum="-44" Maximum="44"></Slider>
                                    </DockPanel>
                                    </Grid>
                            </StackPanel>
                        </Border>
                        <Border Grid.Column="8" BorderBrush="Black" BorderThickness="1" CornerRadius="5,5,5,5">
                            <Grid Name="ColorGrid">
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="45" />
                                    <ColumnDefinition />
                                    <ColumnDefinition Width="45" />
                                    <ColumnDefinition Width="150" />
                                </Grid.ColumnDefinitions>
                                <Label Grid.Column="0" Grid.Row="1">Color</Label>
                                <Label Grid.Column="2" Grid.Row="0">Red</Label>
                                <Grid Grid.Column="3" Grid.Row="0" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="30"/>
                                    </Grid.ColumnDefinitions>
                                    <Label Grid.Column="0">0</Label>
                                    <Slider Name="ColorRedSlider" Grid.Column="1" Width="150" Maximum="255" TabIndex="14"></Slider>
                                    <Label Grid.Column="2">255</Label>
                                </Grid>
                                <Label Grid.Column="2" Grid.Row="1">Green</Label>
                                <Grid Grid.Column="3" Grid.Row="1">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="30"/>
                                    </Grid.ColumnDefinitions>
                                    <Label Grid.Column="0">0</Label>
                                    <Slider Name="ColorGreenSlider" Grid.Column="1" Width="150" Maximum="255" TabIndex="15"></Slider>
                                    <Label Grid.Column="2">255</Label>
                                </Grid>
                                <Label Grid.Column="2" Grid.Row="2">Blue</Label>
                                <Grid Grid.Column="3" Grid.Row="2">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="20"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="30"/>
                                    </Grid.ColumnDefinitions>
                                    <Label Grid.Column="0">0</Label>
                                    <Slider Name="ColorBlueSlider" Grid.Column="1" Width="150" Maximum="255" TabIndex="16"></Slider>
                                    <Label Grid.Column="2">255</Label>
                                </Grid>
                                <Button Style="{StaticResource ColorButton}"  Name="CurrentColorValue" Grid.Column="1" Grid.RowSpan="3" Margin="5" Command="Commands:UICommands.SetPenColor" TabIndex="13" Content="Click to change...">
                                </Button>

                            </Grid>
                        </Border>
                        <Border Grid.Column="9" BorderBrush="Black" BorderThickness="1" CornerRadius="5" Visibility="Collapsed">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25"/>
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="20"/>
                                    <ColumnDefinition/>
                                    <ColumnDefinition Width="20"/>
                                </Grid.ColumnDefinitions>
                                <Image Grid.Column="0" Height="20" HorizontalAlignment="Center" Source="../Content/Zoom_Out.png"/>
                                <Label FontSize="10" Grid.Column="1" Grid.Row="0" HorizontalContentAlignment="Center">Zoom</Label>
                                <Image Grid.Column="2" Height="20" HorizontalAlignment="Center" Source="../Content/Zoom_In.png"/>
                                <Slider Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Center" Name="ZoomSliderOld" Value="1" Minimum="0.1" Maximum="5" IsSnapToTickEnabled="True" TickFrequency="0.1" TabIndex="16" TickPlacement="Both"></Slider>
                            </Grid>
                        </Border>

                    </Grid>
                </Expander>
                <Grid Name="MainPanel" DockPanel.Dock="Top">
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                        <Border BorderThickness="1" BorderBrush="Black">
                            <Border.LayoutTransform>
                                <ScaleTransform ScaleX="{Binding ElementName=ZoomSlider, Path=Value}" ScaleY="{Binding ElementName=ZoomSlider, Path=Value}"/>
                            </Border.LayoutTransform>
                            <Border Name="InkCanvasBorder" BorderBrush="Black" BorderThickness="2" Height="600" Width="800">
                                <InkCanvas Name="CurrentInkCanvas" MouseUp="CurrentInkCanvas_MouseUp" MouseDown="CurrentInkCanvas_MouseDown" EditingModeInverted="EraseByPoint" SelectionMoving="CurrentInkCanvas_SelectionMoving" SelectionResizing="CurrentInkCanvas_SelectionResizing" KeyUp="CurrentInkCanvas_KeyUp" Background="{Binding ElementName=MainWindowInstance,Path=CanvasColor}">
                                    <InkCanvas.ContextMenu>
                                        <ContextMenu>
                                            <MenuItem Header="_Copy" Name="InkCopyContextMenuItem" Command="ApplicationCommands.Copy"></MenuItem>
                                            <MenuItem Header="Cu_t" Name="InkCutContextMenuItem" Command="ApplicationCommands.Cut"></MenuItem>
                                            <MenuItem Header="_Paste" Name="InkPasteContextMenuItem" Command="ApplicationCommands.Paste"></MenuItem>
                                            <Separator></Separator>
                                            <MenuItem Header="_Undo" Name="InkUndoContextMenuItem" Command="ApplicationCommands.Undo"></MenuItem>
                                            <MenuItem Header="_Redo" Name="InkRedoContextMenuItem" Command="ApplicationCommands.Redo"></MenuItem>
                                        </ContextMenu>
                                    </InkCanvas.ContextMenu>
                                </InkCanvas>
                            </Border>
                        </Border>
                    </ScrollViewer>
                </Grid>
            </DockPanel>
        </DockPanel>
    </Grid>
</R:RibbonWindow>
